/*
 * adc.h
 *
 * Created: 6/18/2013 6:52:55 PM
 *  Author: Tim
 */ 


#ifndef ADC_H_
#define ADC_H_

#include "../../packets/status.h"
#include "../../packets/structs/adcPacketStructs.h"


#define ADC_DMA_MODE

void adcSetup();

int16_t filterData(int16_t *data);

void adcSetGain(ACHM_t achm, uint8_t gain);
void adcSetChGainOffset(uint8_t channel,uint8_t gain);

#ifndef ADC_DMA_MODE
volatile int16_t adcCh0_data[16];
volatile int16_t adcCh1_data[16];
volatile int16_t adcCh2_data[16];
volatile int16_t adcCh3_data[16];

#else

volatile int16_t ADC_DMA_data[16][4];

#define adcCh0_data (ADC_DMA_data[0][0])
#define adcCh1_data (ADC_DMA_data[0][1])
#define adcCh2_data (ADC_DMA_data[0][2])
#define adcCh3_data (ADC_DMA_data[0][3])

#endif

volatile struct cntRegs
{
	uint8_t	CNT			:4;
	uint8_t	reserved	:4;
}adcCnt[4];

#endif /* ADC_H_ */